#include <bits/stdc++.h>

using namespace std;
#define int long long
const int inf = 0x3f3f3f3f;

void solve()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    vector<int> premin(n + 1, inf), sufmax(n + 1, -inf);
    for (int i = 1; i <= n; i++) premin[i] = min(premin[i - 1], a[i - 1]);
    for (int i = n - 1; i >= 0; i--) sufmax[i] = max(sufmax[i + 1], a[i]);
    string ans;
    for (int i = 0; i < n; i++)
    {
        if (premin[i + 1] == a[i] || sufmax[i] == a[i]) ans += '1';
        else ans += '0';
    }
    cout << ans << '\n';
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int _ = 1;
    cin >> _;
    while (_--)
    {
        solve();
    }
    return 0;
}